//@PCSTART@//
package com.bluetane.pc;
//@PCEND@//
/*//@ANDROIDSTART@//
package com.bluetane.android;
//@ANDROIDEND@//*/

//@PCSTART@//
import javax.bluetooth.RemoteDevice;
//@PCEND@//
/*//@ANDROIDSTART@//
import android.bluetooth.BluetoothDevice;
//@ANDROIDEND@//*/

public class BtRemoteDevice
{

    //@PCSTART@//
    private String name=null;
    RemoteDevice remoteDevice;//neiter private or public
    //@PCEND@//
    /*//@ANDROIDSTART@//
	BluetoothDevice remoteDevice;
	//@ANDROIDEND@//*/

    /**
     * Creates remote device. Android code.
     */
    /*//@ANDROIDSTART@//
	public BtRemoteDevice(BluetoothDevice startRemoteDevice)
	{
		remoteDevice = startRemoteDevice;
	}
	//@ANDROIDEND@//*/
	//@PCSTART@//
    /**
     * Creates remote device. PC code.
     
     */
    public BtRemoteDevice(RemoteDevice remoteD)
    {
        super();
        remoteDevice=remoteD;
    }
    //@PCEND@//

	public String getAddress()
	{
    /*//@ANDROIDSTART@//
		return remoteDevice.getAddress();
	//@ANDROIDEND@//*/
	//@PCSTART@//
        return remoteDevice.getBluetoothAddress();
    //@PCEND@//
	}
	
	public String getName()
	{
		/*//@ANDROIDSTART@//
		return remoteDevice.getName();
		//@ANDROIDEND@//*/
		//@PCSTART@//
        if(name==null){
            try{
                name=remoteDevice.getFriendlyName(false);//true
            } catch(Exception e){
                System.err.println("Error getting name");
            }
        }

        if(name==null) return "";
        return name;
		//@PCEND@//
    }

	//@PCSTART@//
    public boolean deviceExists(String bluetoothAddress){
        return bluetoothAddress.equals(remoteDevice.getBluetoothAddress());
    }
	//@PCEND@//

    /*//@ANDROIDSTART@//
	public boolean equals(BtRemoteDevice compare)
	{
		return this.getAddress().equals(compare.getAddress());
	}

	public BluetoothDevice getDevice()
	{
		return remoteDevice;
	}
	//@ANDROIDEND@//*/
}
